package com.geekaca.d4.regx;

public class Test1 {
    public static void main(String[] args) {
        String qq="987687";
        System.out.println(checkQQ(qq));
        System.out.println(checkQQ("8870"));

        System.out.println("======================");
        System.out.println("checkQQ2(\"87896\") = " + checkQQ2("87896"));
        System.out.println(checkQQ2("1232342345"));


    }

    public static  boolean checkQQ(String qq){
        if(qq==null||qq.length()<6||qq.length()>20){
            return false;
        }
        for (int i = 0; i < qq.length(); i++) {
            char ch = qq.charAt(i);
            if(ch<'0'||ch>'9'){
                return false;
            }
        }
        return true;

    }

    public static boolean checkQQ2(String qq2){
        return  qq2!=null && qq2.matches("\\d{6,20}");
    }
}
